package stu.day9_day18;

public class LeetCode11 {
    public int maxArea(int[] height) {
        int pri = 0;
        int end = height.length - 1;
        int max = 0;
        while (end > pri) {
            int num = Math.min(height[pri], height[end])*(end - pri);
            max = Math.max(max, num);

            if(height[pri] > height[end]){
                end -= 1;
                continue;
            } else if (height[pri] <= height[end]) {
                pri += 1;
                continue;
            }

        }

        return max;

    }

}
